<?php

use console\db\channels\TransferTableMigration;

/**
 * 活动转移
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m300200_100040_t_activity extends TransferTableMigration {

    /**
     * @inheritdoc
     */
    public $sourceDb = 'olddb';

    /**
     * @inheritdoc
     */
    public function getTransferOptions() {
        return [
            'table' => [
                'activity' => 'activities',
            ],
            'columns' => [
                'id',
                'name' => 'title',
                'description' => 'subtitle',
                'type',
                'begin_time' => 'starttime',
                'end_time' => 'endtime',
                'form_id' => 'formid',
                'brand' => 'logo',
                'cover' => 'banner',
                'content',
                'template',
                'recommend_at' => 'recommend',
                'listorder',
                'created_at' => 'inputtime',
                'updated_at' => 'updatetime',
                'status' => function($data) {
                    if ($data['status'] == 1) {
                        return 10;
                    }
                    return $data['status'];
                },
            ],
        ];
    }

}
